home *** CD-ROM | disk | FTP | other *** search
Text File | 1991-06-23 | 1.3 KB | 58 lines | [TEXT/?bDv] |
- !
- ! Corner
- !
- ! This bot is just like Finder, except that it first moves into
- ! the upper-left (0,0) corner of the arena. This way, it only
- ! needs to scan a 90 degree arc to cover the whole arena.
- !
-
- #DATA
-
- EQU INCR 7
-
- DEF s
- DEF tempScan
-
- #CODE BASIC
-
- :XMoveToCorner
- Velocity -$XLOC, 0 ! Velocity equals negative position
- If ($XLOC > 10) Then
- Goto XMoveToCorner
- :YMoveToCorner
- Velocity 0, -$YLOC ! Velocity equals negative position
- If ($YLOC > 10) Then
- Goto YMoveToCorner
- Velocity 0, 0 ! (ELSE) stop
-
- ! This bot uses a FOR-NEXT loop to make a given scan pass. It
- ! only scans up to 93 degrees so that it doesn't waste time
- ! scanning the arena wall.
-
- :ScanLoop
- For s = Random(INCR)-3 To 93 Step INCR
- SCAN ANGLE S
- If ($FOUND <> 0) Then Gosub LockWeapon
- Next S
-
- Goto ScanLoop
-
-
- ! This is a subroutine to fire at a located enemy bot. The
- ! scanner information about the bot is presumed to be in the S
- ! registers.
-
- :LockWeapon
- Fire Weapon 1, Angle $ANGLE
- tempScan = $ANGLE
- Scan Angle tempScan
- If ($FOUND <> 0) Then Goto LockWeapon
-
- Scan Angle tempScan-20 ! Try to find the bot again
- If ($FOUND <> 0) Then Goto LockWeapon
- Scan Angle tempScan-10
- If ($FOUND <> 0) Then Goto LockWeapon
- Return ! Couldn't find it.
-
- #END
-